// server.cpp
#include "NamedPipe.h"
#include <string>
#include <thread>
#include <chrono>

void reader(NamedPipe &pipe) {
    while (true) {
        std::string received = pipe.read();
        std::cout << "Client received: " << received << std::endl;
    }
}

void writer(NamedPipe &pipe) {
    while (true) {
        std::string message;
        std::getline(std::cin, message);
		pipe.write(message);
    }
}



int main() {
    NamedPipe serverPipe("/tmp/server_pipe");
    NamedPipe clientPipe("/tmp/client_pipe");


    while (true)
	{
 
     
		std::string message;
        std::getline(std::cin, message);
        serverPipe.write(message);


		message = serverPipe.read();
        if (!message.empty()) {
            std::cout << "Received from client: " << message << std::endl;
        }

		sleep(10);
    }
    return 0;
}



